package StudyCode.summary.mycollection;

/**
 * 版权所有 科技与人文(www.tah1986.com)
 */
public class DeterminesWhetherASpecifiedWordHasAlreadyBeenAddedToTheArray {
	public static void main(String[] argv) {
		String word = "www.tah1986.com";
		String[] array = new String[]{"1", "abc", "level", null,
				"www.tah1986.com", "asdf 123"};
		System.out.println("数组是否包含 www.tah1986.com ？" + wordAlreadyAdded(word, array));
	}

	private static boolean wordAlreadyAdded(String word, String[] array) {
		for (int i = 0; i < array.length; i++) {
			if (array[i] != null && array[i].equalsIgnoreCase(word)) {
				return true;
			}
		}
		return false;
	}
}
